
//ICC通信接口
//ICC Communication Interface

#ifndef __ICI_H__
#define __ICI_H__

#include <stdint.h>

#include "Connector.h"

typedef struct {
	uint8_t FiDi;
	uint8_t stopbit;
	uint8_t reverse;
}ICI_Config_T;

int ICI_Register(uint8_t num, connector_t* conn, void* usart);
void ICI_Unregister(uint8_t num);

int ICI_Check(uint8_t num);
void ICI_ColdReset(uint8_t num);
void ICI_WarmReset(uint8_t num);

void ICI_SetETU(uint8_t num, uint8_t FiDi);
void ICI_SetStopbits(uint8_t num, uint8_t stopbits);
void ICI_ConfigByteDirection(uint8_t num, uint8_t direction);
void ICI_Config(uint8_t num, ICI_Config_T* cfg);


void ICI_Delay(uint8_t num, uint32_t etu);
void ICI_TimerStart(uint8_t num, uint8_t timer, uint32_t etu);
void ICI_TimerStop(uint8_t num, uint8_t timer);

int ICI_SendByte(uint8_t num, uint8_t byte, uint8_t retry, uint32_t guard);
int ICI_ReceiveByte(uint8_t num, uint8_t retry, uint8_t* byte);


#endif



